<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class ArticleModel extends Model
{
    use SoftDeletes;

    protected $table = 'articles';

    protected $primaryKey = 'aid';

    protected $fillable = ['title', 'content', 'zan', 'views', 'poster'];

    public function getUpdatedAtAttribute($date)
    {
        return Carbon::createFromFormat('Y-m-d H:i:s', $date)->diffForHumans();
    }
}
